/* APK Express 样式文件 */

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    height: 100vh;
    overflow: hidden;
    /* 防止页面整体滚动 */
}

.app-layout {
    display: flex;
    height: 100vh;
    /* 确保占满整个视口高度 */
}

/* 侧边栏样式 - 支持滚动 */
.sidebar {
    width: 280px;
    background: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* 确保侧边栏占满整个视口高度 */
}

.sidebar-header {
    padding: 20px;
    background: #4CAF50;
    color: white;
    text-align: center;
    flex-shrink: 0;
    /* 防止头部被压缩 */
}

.sidebar-header h3 {
    margin: 0;
    font-size: 16px;
}

/* 可滚动的内容区域 */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.packager-section {
    border-bottom: 1px solid #eee;
}

.packager-header {
    padding: 15px 20px;
    background: #f8f9fa;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    position: sticky;
    top: 0;
    z-index: 10;
    /* 确保打包机头部在滚动时保持可见 */
}

.packager-header:hover {
    background: #e9ecef;
}

.packager-header.active {
    background: #e8f5e8;
    color: #4CAF50;
}

.packager-name {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.packager-toggle {
    transition: transform 0.2s;
}

.packager-toggle.expanded {
    transform: rotate(90deg);
}

.folder-list {
    background: #fafafa;
    max-height: none;
    /* 移除最大高度限制 */
    overflow: visible;
    /* 允许内容正常显示 */
    transition: none;
    /* 移除动画，改为简单的显示/隐藏 */
}

.folder-list.expanded {
    display: block;
}

.folder-list:not(.expanded) {
    display: none;
}

.folder-item {
    padding: 8px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    min-height: 36px;
    position: relative;
}

.folder-item:hover {
    background: #f0f0f0;
}

.folder-item.active {
    background: #e8f5e8;
    color: #4CAF50;
    font-weight: bold;
}

.folder-item:last-child {
    border-bottom: none;
}

/* 树形结构缩进 */
.folder-item[data-level="0"] {
    padding-left: 20px;
}

.folder-item[data-level="1"] {
    padding-left: 35px;
}

.folder-item[data-level="2"] {
    padding-left: 50px;
}

.folder-item[data-level="3"] {
    padding-left: 65px;
}

.folder-item[data-level="4"] {
    padding-left: 80px;
}

.folder-item[data-level="5"] {
    padding-left: 95px;
}

.folder-item[data-level="6"] {
    padding-left: 110px;
}

/* 层级线条 */
.folder-item[data-level]:not([data-level="0"])::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-left: 1px solid #ddd;
    margin-left: calc(20px + (var(--level) - 1) * 15px);
}

.folder-item[data-level]:not([data-level="0"])::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: calc(20px + var(--level) * 15px);
    height: 1px;
    background: #ddd;
    margin-left: calc(20px + (var(--level) - 1) * 15px);
}

.folder-name {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.folder-expand-toggle {
    cursor: pointer;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: transform 0.2s;
    margin-right: 4px;
}

.folder-expand-toggle.expanded {
    transform: rotate(90deg);
}

.folder-expand-toggle:empty {
    width: 16px;
    /* 保持对齐 */
}

.folder-name span:last-child {
    word-break: break-all;
    overflow-wrap: break-word;
    line-height: 1.3;
    font-size: 13px;
}

.apk-count {
    background: #666;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    min-width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.folder-item.active .apk-count {
    background: #4CAF50;
}

/* 隐藏折叠的子文件夹 */
.folder-item.collapsed {
    display: none;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    overflow-y: auto;
    height: 100vh;
    /* 确保主内容区域也占满视口高度 */
    padding: 20px;
}

.container {
    max-width: none;
    margin: 0;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #4CAF50;
}

.content-title {
    color: #333;
    margin: 0;
    word-break: break-all;
    /* 允许长路径换行 */
    overflow-wrap: break-word;
    line-height: 1.3;
    font-size: 24px;
}

/* 响应式字体大小 */
@media (max-width: 768px) {
    .content-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .content-title {
        font-size: 16px;
    }
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    /* 改为顶部对齐以支持多行标题 */
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #4CAF50;
    gap: 15px;
    /* 增加间距 */
}

/* 在移动端改为垂直布局 */
@media (max-width: 768px) {
    .content-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .view-controls {
        justify-content: space-between;
    }
}

.view-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.sort-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-control select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.admin-link {
    color: #4CAF50;
    text-decoration: none;
    padding: 8px 15px;
    border: 1px solid #4CAF50;
    border-radius: 4px;
    transition: all 0.2s;
}

.admin-link:hover {
    background: #4CAF50;
    color: white;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #4CAF50;
}

.server-info {
    background: #e8f5e8;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 30px;
    border-left: 4px solid #4CAF50;
}

.apk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.apk-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    transition: transform 0.2s, box-shadow 0.2s;
}

.apk-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.apk-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    word-break: break-all;
}

.apk-info {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.download-btn {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background 0.3s;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.download-btn:hover {
    background: #45a049;
}

.no-files {
    text-align: center;
    color: #666;
    font-size: 18px;
    padding: 50px;
}

.qr-code {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* 侧边栏收起按钮 */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        overflow: auto;
        /* 移动端允许页面滚动 */
    }

    .app-layout {
        flex-direction: column;
        height: auto;
        /* 移动端不限制高度 */
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        left: -100%;
        transition: left 0.3s ease;
        z-index: 1000;
        max-height: 100vh;
        /* 限制最大高度 */
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        padding: 10px;
        margin-top: 60px;
        height: auto;
        /* 移动端不限制高度 */
        overflow-y: visible;
        /* 移动端允许正常滚动 */
    }

    .container {
        padding: 20px;
    }

    .apk-grid {
        grid-template-columns: 1fr;
    }

    .content-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .view-controls {
        justify-content: space-between;
    }
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 50px;
    color: #666;
}

.loading::after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: ".";
    }

    40% {
        content: "..";
    }

    60% {
        content: "...";
    }

    80%,
    100% {
        content: "";
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.apk-card {
    animation: fadeIn 0.5s ease-out;
}

/* 滚动条样式优化 */
.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Firefox 滚动条样式 */
.sidebar-content {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* 确保在深层目录时也有合适的缩进 */
.folder-item[data-level="7"] {
    padding-left: 125px;
}

.folder-item[data-level="8"] {
    padding-left: 140px;
}

.folder-item[data-level="9"] {
    padding-left: 155px;
}

.folder-item[data-level="10"] {
    padding-left: 170px;
}

/* 当前目录最新APK样式 */
#currentDirLatest {
    margin-bottom: 30px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.latest-apk-header {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.latest-apk-header h3 {
    margin: 0;
    color: white;
    font-size: 18px;
    text-align: center;
}

.latest-apk-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
}

.latest-apk-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #FF9800;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.latest-apk-info {
    flex: 1;
    min-width: 0;
}

.latest-apk-name {
    font-size: 20px;
    font-weight: bold;
    color: white;
    margin-bottom: 8px;
    word-break: break-all;
}

.latest-apk-details {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.latest-apk-actions {
    flex-shrink: 0;
}

.latest-download-btn {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: all 0.3s;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.latest-download-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .latest-apk-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 15px;
    }

    .latest-apk-name {
        font-size: 18px;
    }

    .latest-apk-details {
        font-size: 13px;
    }

    .latest-download-btn {
        padding: 10px 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .latest-apk-badge {
        position: static;
        display: inline-block;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .latest-apk-header h3 {
        font-size: 16px;
    }

    .latest-apk-name {
        font-size: 16px;
    }

    .latest-apk-details {
        font-size: 12px;
        line-height: 1.4;
    }
}

/* 增强现有APK网格的对比 */
.apk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
    /* 与最新APK区域保持距离 */
}

/* 首页专用样式 */
.homepage-info {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.homepage-info p {
    margin: 0;
    font-weight: bold;
}

.homepage-card {
    position: relative;
    border: 2px solid #e8f5e8;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
}

.homepage-card:hover {
    border-color: #4CAF50;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.15);
}

.project-badge {
    position: absolute;
    top: -10px;
    right: 15px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.card-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.latest-btn {
    flex: 2;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: none;
    font-weight: bold;
}

.latest-btn:hover {
    background: linear-gradient(135deg, #45a049, #388e3c);
    transform: translateY(-2px);
}

.view-all-btn {
    flex: 1;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.view-all-btn:hover {
    background: #e9ecef;
    border-color: #4CAF50;
    color: #4CAF50;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .card-actions {
        flex-direction: column;
    }

    .latest-btn,
    .view-all-btn {
        flex: none;
    }

    .project-badge {
        position: static;
        display: inline-block;
        margin-bottom: 10px;
    }
}